MAC vendor lookup: Difference between revisions

→‎{{header|APL}}: Add implementation.
(→‎{{header|APL}}: Add implementation.)
Line 74:
vendorLookup1 ← { (HttpCommand.Get 'http://api.macvendors.com/',⍕⍵).Data }
 
⍝ define a traditional function to look up all the MAC addresses onin a list with
⍝ a delay between calls
 
⍝ The header says that the function is named vendorLookup, it takes a single parameter
calledparameter macListwhich inwe thecall bodymacList, and the value of the local variable vendors will become
itsvendors will become the function's return value
∇ vendors ← vendorLookup macList
 
vendors ← ⊆vendorLookup1 macList[1] ⍝ look up the first vendor
⍝ look up the first vendor and put it into an array in our return var
vendors ← ⊆vendorLookup1 macList[1] ⍝ look up the first vendor
 
⍝ Loop over the rest of the array (1↓ removes the first item)
:For burger :In 1↓macList
⎕DL 2 wait 2 seconds
vendors ⍪← ⊆vendorLookup⊆vendorLookup1 burger. then look up the next vendor and append to result
:EndFor
⍝ end function definition</lang>
 
</lang>
{{Out}}
<pre> macList ← '88:53:2E:67:07:BE' 'D4:F4:6F:C9:EF:8D' 'FC:FB:FB:01:FA:21'
macList ⍪← '4c:72:b9:56:fe:bc' '00-14-22-01-23-45'
 
vendorList ← vendorLookup macList
(⍴ vendorList)[1] 1⍴ vendorList
Intel Corporate
Apple, Inc.
Cisco Systems, Inc
PEGATRON CORPORATION
Dell Inc.
</langpre>
 
=={{header|AppleScript}}==
1,480

edits