MAC vendor lookup: Difference between revisions
Content added Content deleted
(→{{header|PHP}}: Add implementation.) |
(→{{header|APL}}: Add implementation) |
||
Line 61: | Line 61: | ||
23-45-67 N/A |
23-45-67 N/A |
||
foobar N/A</pre> |
foobar N/A</pre> |
||
=={{header|APL}}== |
|||
{{works with|Dyalog APL}} |
|||
{{libheader|HttpCommand}} |
|||
Normally something like this would just be mapping the lookup across an array, but that doesn't let us control the timing of the request dispatch. To insert a delay between requests we have to create a traditional function ("tradfn") with a for loop. |
|||
<lang apl>⍝load the library module |
|||
]load HttpCommand |
|||
⍝ define a direct function (dfn) to look up a single MAC address |
|||
vendorLookup1 ← { (HttpCommand.Get 'http://api.macvendors.com/',⍕⍵).Data } |
|||
⍝ define a traditional function to look up all the MAC addresses on a list with |
|||
⍝ a delay between calls |
|||
⍝ The header says that the function is named vendorLookup, it takes a single parameter |
|||
⍝ called macList in the body, and the value of the local variable vendors will become |
|||
⍝ its return value |
|||
∇ vendors ← vendorLookup macList |
|||
vendors ← ⊆vendorLookup1 macList[1] ⍝ look up the first vendor |
|||
:For burger :In 1↓macList |
|||
⎕DL 2 ⍝ wait 2 seconds |
|||
vendors ⍪← ⊆vendorLookup burger. ⍝ look up the next vendor |
|||
:EndFor |
|||
∇ ⍝ end function definition |
|||
=={{header|AppleScript}}== |
=={{header|AppleScript}}== |